package com.uxwine.skin;

import android.content.Context;
import android.content.res.Resources;

public class SkinManager
{
	Context mCtx;
	Resources mRes;
	String mPackageName;
	static SkinManager mInstance;
	public static synchronized SkinManager getInstance(Context ctx)
	{
		if(null == mInstance)
			mInstance = new SkinManager(ctx.getApplicationContext());
		return mInstance;
	}
	private SkinManager(Context ctx)
	{
		mCtx = ctx;
		mRes = mCtx.getResources();
		mPackageName = ctx.getPackageName();
	}
	
	public int getIdentifier(String name, String defType)
	{
		return mRes.getIdentifier(name, defType, mPackageName);		
	}
	
	public int getDrawable(String name)
	{
		return getIdentifier(name, "drawable");
	}
	
	public int getColorIdentifier(String name)
	{
		final int c = getIdentifier(name, "color");
		return c;
	}	
	
	public int getColor(String name)
	{
		final int c = getIdentifier(name, "color");
		return mRes.getColor(c);
	}	
}
